﻿#region Using directives

using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using NetROS.Tiers.Entities;
using NetROS.Tiers.Data;

#endregion

namespace NetROS.Tiers.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="VwDokumentProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract class VwDokumentProviderBaseCore : EntityViewProviderBase<VwDokument>
	{
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions
		
		/*
		///<summary>
		/// Fill an VList&lt;VwDokument&gt; From a DataSet
		///</summary>
		/// <param name="dataSet">the DataSet</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList&lt;VwDokument&gt;"/></returns>
		protected static VList&lt;VwDokument&gt; Fill(DataSet dataSet, VList<VwDokument> rows, int start, int pagelen)
		{
			if (dataSet.Tables.Count == 1)
			{
				return Fill(dataSet.Tables[0], rows, start, pagelen);
			}
			else
			{
				return new VList<VwDokument>();
			}	
		}
		
		
		///<summary>
		/// Fill an VList&lt;VwDokument&gt; From a DataTable
		///</summary>
		/// <param name="dataTable">the DataTable that hold the data.</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList<VwDokument>"/></returns>
		protected static VList&lt;VwDokument&gt; Fill(DataTable dataTable, VList<VwDokument> rows, int start, int pagelen)
		{
			int recordnum = 0;
			
			System.Collections.IEnumerator dataRows =  dataTable.Rows.GetEnumerator();
			
			while (dataRows.MoveNext() && (pagelen != 0))
			{
				if(recordnum >= start)
				{
					DataRow row = (DataRow)dataRows.Current;
				
					VwDokument c = new VwDokument();
					c.Oznaka = (Convert.IsDBNull(row["Oznaka"]))?string.Empty:(System.String)row["Oznaka"];
					c.Datum = (Convert.IsDBNull(row["Datum"]))?DateTime.MinValue:(System.DateTime)row["Datum"];
					c.Od = (Convert.IsDBNull(row["Od"]))?string.Empty:(System.String)row["Od"];
					c.Prema = (Convert.IsDBNull(row["Prema"]))?string.Empty:(System.String)row["Prema"];
					c.Primio = (Convert.IsDBNull(row["Primio"]))?string.Empty:(System.String)row["Primio"];
					c.Izdao = (Convert.IsDBNull(row["Izdao"]))?string.Empty:(System.String)row["Izdao"];
					c.ImeKlijenta = (Convert.IsDBNull(row["ImeKlijenta"]))?string.Empty:(System.String)row["ImeKlijenta"];
					c.Transport = (Convert.IsDBNull(row["Transport"]))?string.Empty:(System.String)row["Transport"];
					c.Napomena = (Convert.IsDBNull(row["Napomena"]))?string.Empty:(System.String)row["Napomena"];
					c.Napomena2 = (Convert.IsDBNull(row["Napomena2"]))?string.Empty:(System.String)row["Napomena2"];
					c.IDDokumentTip = (Convert.IsDBNull(row["IDDokumentTip"]))?(int)0:(System.Int32)row["IDDokumentTip"];
					c.NabavnaVrijednost = (Convert.IsDBNull(row["NabavnaVrijednost"]))?0:(System.Decimal?)row["NabavnaVrijednost"];
					c.IDDokument = (Convert.IsDBNull(row["IDDokument"]))?(int)0:(System.Int32)row["IDDokument"];
					c.IDStatus = (Convert.IsDBNull(row["IDStatus"]))?(int)0:(System.Int32)row["IDStatus"];
					c.IDOrganizacijaPrema = (Convert.IsDBNull(row["IDOrganizacijaPrema"]))?(int)0:(System.Int32?)row["IDOrganizacijaPrema"];
					c.IDOrganizacijaOd = (Convert.IsDBNull(row["IDOrganizacijaOd"]))?(int)0:(System.Int32?)row["IDOrganizacijaOd"];
					c.IDNacinTransporta = (Convert.IsDBNull(row["IDNacinTransporta"]))?(int)0:(System.Int32?)row["IDNacinTransporta"];
					c.IDNacinPlacanja = (Convert.IsDBNull(row["IDNacinPlacanja"]))?(int)0:(System.Int32?)row["IDNacinPlacanja"];
					c.NacinPlacanja = (Convert.IsDBNull(row["NacinPlacanja"]))?string.Empty:(System.String)row["NacinPlacanja"];
					c.VezaDokumenta = (Convert.IsDBNull(row["VezaDokumenta"]))?string.Empty:(System.String)row["VezaDokumenta"];
					c.DatumDo = (Convert.IsDBNull(row["DatumDo"]))?DateTime.MinValue:(System.DateTime?)row["DatumDo"];
					c.IDParent = (Convert.IsDBNull(row["IDParent"]))?(int)0:(System.Int32?)row["IDParent"];
					c.DTSkraceni = (Convert.IsDBNull(row["DTSkraceni"]))?string.Empty:(System.String)row["DTSkraceni"];
					c.RedBr = (Convert.IsDBNull(row["RedBr"]))?(int)0:(System.Int32?)row["RedBr"];
					c.SifraSkladista = (Convert.IsDBNull(row["SifraSkladista"]))?string.Empty:(System.String)row["SifraSkladista"];
					c.AcceptChanges();
					rows.Add(c);
					pagelen -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		*/	
						
		///<summary>
		/// Fill an <see cref="VList&lt;VwDokument&gt;"/> From a DataReader.
		///</summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pageLength">number of row.</param>
		///<returns>a <see cref="VList&lt;VwDokument&gt;"/></returns>
		protected VList<VwDokument> Fill(IDataReader reader, VList<VwDokument> rows, int start, int pageLength)
		{
			int recordnum = 0;
			while (reader.Read() && (pageLength != 0))
			{
				if(recordnum >= start)
				{
					VwDokument entity = null;
					if (DataRepository.Provider.UseEntityFactory)
					{
						entity = EntityManager.CreateViewEntity<VwDokument>("VwDokument",  DataRepository.Provider.EntityCreationalFactoryType); 
					}
					else
					{
						entity = new VwDokument();
					}
					entity.Oznaka = (System.String)reader["Oznaka"];
					//entity.Oznaka = (Convert.IsDBNull(reader["Oznaka"]))?string.Empty:(System.String)reader["Oznaka"];
					entity.Datum = (System.DateTime)reader["Datum"];
					//entity.Datum = (Convert.IsDBNull(reader["Datum"]))?DateTime.MinValue:(System.DateTime)reader["Datum"];
					entity.Od = (System.String)reader["Od"];
					//entity.Od = (Convert.IsDBNull(reader["Od"]))?string.Empty:(System.String)reader["Od"];
					entity.Prema = reader.IsDBNull(reader.GetOrdinal("Prema")) ? null : (System.String)reader["Prema"];
					//entity.Prema = (Convert.IsDBNull(reader["Prema"]))?string.Empty:(System.String)reader["Prema"];
					entity.Primio = reader.IsDBNull(reader.GetOrdinal("Primio")) ? null : (System.String)reader["Primio"];
					//entity.Primio = (Convert.IsDBNull(reader["Primio"]))?string.Empty:(System.String)reader["Primio"];
					entity.Izdao = (System.String)reader["Izdao"];
					//entity.Izdao = (Convert.IsDBNull(reader["Izdao"]))?string.Empty:(System.String)reader["Izdao"];
					entity.ImeKlijenta = reader.IsDBNull(reader.GetOrdinal("ImeKlijenta")) ? null : (System.String)reader["ImeKlijenta"];
					//entity.ImeKlijenta = (Convert.IsDBNull(reader["ImeKlijenta"]))?string.Empty:(System.String)reader["ImeKlijenta"];
					entity.Transport = reader.IsDBNull(reader.GetOrdinal("Transport")) ? null : (System.String)reader["Transport"];
					//entity.Transport = (Convert.IsDBNull(reader["Transport"]))?string.Empty:(System.String)reader["Transport"];
					entity.Napomena = reader.IsDBNull(reader.GetOrdinal("Napomena")) ? null : (System.String)reader["Napomena"];
					//entity.Napomena = (Convert.IsDBNull(reader["Napomena"]))?string.Empty:(System.String)reader["Napomena"];
					entity.Napomena2 = reader.IsDBNull(reader.GetOrdinal("Napomena2")) ? null : (System.String)reader["Napomena2"];
					//entity.Napomena2 = (Convert.IsDBNull(reader["Napomena2"]))?string.Empty:(System.String)reader["Napomena2"];
					entity.IDDokumentTip = (System.Int32)reader["IDDokumentTip"];
					//entity.IDDokumentTip = (Convert.IsDBNull(reader["IDDokumentTip"]))?(int)0:(System.Int32)reader["IDDokumentTip"];
					entity.NabavnaVrijednost = reader.IsDBNull(reader.GetOrdinal("NabavnaVrijednost")) ? null : (System.Decimal?)reader["NabavnaVrijednost"];
					//entity.NabavnaVrijednost = (Convert.IsDBNull(reader["NabavnaVrijednost"]))?0:(System.Decimal?)reader["NabavnaVrijednost"];
					entity.IDDokument = (System.Int32)reader["IDDokument"];
					//entity.IDDokument = (Convert.IsDBNull(reader["IDDokument"]))?(int)0:(System.Int32)reader["IDDokument"];
					entity.IDStatus = (System.Int32)reader["IDStatus"];
					//entity.IDStatus = (Convert.IsDBNull(reader["IDStatus"]))?(int)0:(System.Int32)reader["IDStatus"];
					entity.IDOrganizacijaPrema = reader.IsDBNull(reader.GetOrdinal("IDOrganizacijaPrema")) ? null : (System.Int32?)reader["IDOrganizacijaPrema"];
					//entity.IDOrganizacijaPrema = (Convert.IsDBNull(reader["IDOrganizacijaPrema"]))?(int)0:(System.Int32?)reader["IDOrganizacijaPrema"];
					entity.IDOrganizacijaOd = reader.IsDBNull(reader.GetOrdinal("IDOrganizacijaOd")) ? null : (System.Int32?)reader["IDOrganizacijaOd"];
					//entity.IDOrganizacijaOd = (Convert.IsDBNull(reader["IDOrganizacijaOd"]))?(int)0:(System.Int32?)reader["IDOrganizacijaOd"];
					entity.IDNacinTransporta = reader.IsDBNull(reader.GetOrdinal("IDNacinTransporta")) ? null : (System.Int32?)reader["IDNacinTransporta"];
					//entity.IDNacinTransporta = (Convert.IsDBNull(reader["IDNacinTransporta"]))?(int)0:(System.Int32?)reader["IDNacinTransporta"];
					entity.IDNacinPlacanja = reader.IsDBNull(reader.GetOrdinal("IDNacinPlacanja")) ? null : (System.Int32?)reader["IDNacinPlacanja"];
					//entity.IDNacinPlacanja = (Convert.IsDBNull(reader["IDNacinPlacanja"]))?(int)0:(System.Int32?)reader["IDNacinPlacanja"];
					entity.NacinPlacanja = reader.IsDBNull(reader.GetOrdinal("NacinPlacanja")) ? null : (System.String)reader["NacinPlacanja"];
					//entity.NacinPlacanja = (Convert.IsDBNull(reader["NacinPlacanja"]))?string.Empty:(System.String)reader["NacinPlacanja"];
					entity.VezaDokumenta = reader.IsDBNull(reader.GetOrdinal("VezaDokumenta")) ? null : (System.String)reader["VezaDokumenta"];
					//entity.VezaDokumenta = (Convert.IsDBNull(reader["VezaDokumenta"]))?string.Empty:(System.String)reader["VezaDokumenta"];
					entity.DatumDo = reader.IsDBNull(reader.GetOrdinal("DatumDo")) ? null : (System.DateTime?)reader["DatumDo"];
					//entity.DatumDo = (Convert.IsDBNull(reader["DatumDo"]))?DateTime.MinValue:(System.DateTime?)reader["DatumDo"];
					entity.IDParent = reader.IsDBNull(reader.GetOrdinal("IDParent")) ? null : (System.Int32?)reader["IDParent"];
					//entity.IDParent = (Convert.IsDBNull(reader["IDParent"]))?(int)0:(System.Int32?)reader["IDParent"];
					entity.DTSkraceni = reader.IsDBNull(reader.GetOrdinal("DTSkraceni")) ? null : (System.String)reader["DTSkraceni"];
					//entity.DTSkraceni = (Convert.IsDBNull(reader["DTSkraceni"]))?string.Empty:(System.String)reader["DTSkraceni"];
					entity.RedBr = reader.IsDBNull(reader.GetOrdinal("RedBr")) ? null : (System.Int32?)reader["RedBr"];
					//entity.RedBr = (Convert.IsDBNull(reader["RedBr"]))?(int)0:(System.Int32?)reader["RedBr"];
					entity.SifraSkladista = (System.String)reader["SifraSkladista"];
					//entity.SifraSkladista = (Convert.IsDBNull(reader["SifraSkladista"]))?string.Empty:(System.String)reader["SifraSkladista"];
					entity.AcceptChanges();
					rows.Add(entity);
					pageLength -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		
		
		/// <summary>
		/// Refreshes the <see cref="VwDokument"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="VwDokument"/> object to refresh.</param>
		protected void RefreshEntity(IDataReader reader, VwDokument entity)
		{
			reader.Read();
			entity.Oznaka = (System.String)reader["Oznaka"];
			//entity.Oznaka = (Convert.IsDBNull(reader["Oznaka"]))?string.Empty:(System.String)reader["Oznaka"];
			entity.Datum = (System.DateTime)reader["Datum"];
			//entity.Datum = (Convert.IsDBNull(reader["Datum"]))?DateTime.MinValue:(System.DateTime)reader["Datum"];
			entity.Od = (System.String)reader["Od"];
			//entity.Od = (Convert.IsDBNull(reader["Od"]))?string.Empty:(System.String)reader["Od"];
			entity.Prema = reader.IsDBNull(reader.GetOrdinal("Prema")) ? null : (System.String)reader["Prema"];
			//entity.Prema = (Convert.IsDBNull(reader["Prema"]))?string.Empty:(System.String)reader["Prema"];
			entity.Primio = reader.IsDBNull(reader.GetOrdinal("Primio")) ? null : (System.String)reader["Primio"];
			//entity.Primio = (Convert.IsDBNull(reader["Primio"]))?string.Empty:(System.String)reader["Primio"];
			entity.Izdao = (System.String)reader["Izdao"];
			//entity.Izdao = (Convert.IsDBNull(reader["Izdao"]))?string.Empty:(System.String)reader["Izdao"];
			entity.ImeKlijenta = reader.IsDBNull(reader.GetOrdinal("ImeKlijenta")) ? null : (System.String)reader["ImeKlijenta"];
			//entity.ImeKlijenta = (Convert.IsDBNull(reader["ImeKlijenta"]))?string.Empty:(System.String)reader["ImeKlijenta"];
			entity.Transport = reader.IsDBNull(reader.GetOrdinal("Transport")) ? null : (System.String)reader["Transport"];
			//entity.Transport = (Convert.IsDBNull(reader["Transport"]))?string.Empty:(System.String)reader["Transport"];
			entity.Napomena = reader.IsDBNull(reader.GetOrdinal("Napomena")) ? null : (System.String)reader["Napomena"];
			//entity.Napomena = (Convert.IsDBNull(reader["Napomena"]))?string.Empty:(System.String)reader["Napomena"];
			entity.Napomena2 = reader.IsDBNull(reader.GetOrdinal("Napomena2")) ? null : (System.String)reader["Napomena2"];
			//entity.Napomena2 = (Convert.IsDBNull(reader["Napomena2"]))?string.Empty:(System.String)reader["Napomena2"];
			entity.IDDokumentTip = (System.Int32)reader["IDDokumentTip"];
			//entity.IDDokumentTip = (Convert.IsDBNull(reader["IDDokumentTip"]))?(int)0:(System.Int32)reader["IDDokumentTip"];
			entity.NabavnaVrijednost = reader.IsDBNull(reader.GetOrdinal("NabavnaVrijednost")) ? null : (System.Decimal?)reader["NabavnaVrijednost"];
			//entity.NabavnaVrijednost = (Convert.IsDBNull(reader["NabavnaVrijednost"]))?0:(System.Decimal?)reader["NabavnaVrijednost"];
			entity.IDDokument = (System.Int32)reader["IDDokument"];
			//entity.IDDokument = (Convert.IsDBNull(reader["IDDokument"]))?(int)0:(System.Int32)reader["IDDokument"];
			entity.IDStatus = (System.Int32)reader["IDStatus"];
			//entity.IDStatus = (Convert.IsDBNull(reader["IDStatus"]))?(int)0:(System.Int32)reader["IDStatus"];
			entity.IDOrganizacijaPrema = reader.IsDBNull(reader.GetOrdinal("IDOrganizacijaPrema")) ? null : (System.Int32?)reader["IDOrganizacijaPrema"];
			//entity.IDOrganizacijaPrema = (Convert.IsDBNull(reader["IDOrganizacijaPrema"]))?(int)0:(System.Int32?)reader["IDOrganizacijaPrema"];
			entity.IDOrganizacijaOd = reader.IsDBNull(reader.GetOrdinal("IDOrganizacijaOd")) ? null : (System.Int32?)reader["IDOrganizacijaOd"];
			//entity.IDOrganizacijaOd = (Convert.IsDBNull(reader["IDOrganizacijaOd"]))?(int)0:(System.Int32?)reader["IDOrganizacijaOd"];
			entity.IDNacinTransporta = reader.IsDBNull(reader.GetOrdinal("IDNacinTransporta")) ? null : (System.Int32?)reader["IDNacinTransporta"];
			//entity.IDNacinTransporta = (Convert.IsDBNull(reader["IDNacinTransporta"]))?(int)0:(System.Int32?)reader["IDNacinTransporta"];
			entity.IDNacinPlacanja = reader.IsDBNull(reader.GetOrdinal("IDNacinPlacanja")) ? null : (System.Int32?)reader["IDNacinPlacanja"];
			//entity.IDNacinPlacanja = (Convert.IsDBNull(reader["IDNacinPlacanja"]))?(int)0:(System.Int32?)reader["IDNacinPlacanja"];
			entity.NacinPlacanja = reader.IsDBNull(reader.GetOrdinal("NacinPlacanja")) ? null : (System.String)reader["NacinPlacanja"];
			//entity.NacinPlacanja = (Convert.IsDBNull(reader["NacinPlacanja"]))?string.Empty:(System.String)reader["NacinPlacanja"];
			entity.VezaDokumenta = reader.IsDBNull(reader.GetOrdinal("VezaDokumenta")) ? null : (System.String)reader["VezaDokumenta"];
			//entity.VezaDokumenta = (Convert.IsDBNull(reader["VezaDokumenta"]))?string.Empty:(System.String)reader["VezaDokumenta"];
			entity.DatumDo = reader.IsDBNull(reader.GetOrdinal("DatumDo")) ? null : (System.DateTime?)reader["DatumDo"];
			//entity.DatumDo = (Convert.IsDBNull(reader["DatumDo"]))?DateTime.MinValue:(System.DateTime?)reader["DatumDo"];
			entity.IDParent = reader.IsDBNull(reader.GetOrdinal("IDParent")) ? null : (System.Int32?)reader["IDParent"];
			//entity.IDParent = (Convert.IsDBNull(reader["IDParent"]))?(int)0:(System.Int32?)reader["IDParent"];
			entity.DTSkraceni = reader.IsDBNull(reader.GetOrdinal("DTSkraceni")) ? null : (System.String)reader["DTSkraceni"];
			//entity.DTSkraceni = (Convert.IsDBNull(reader["DTSkraceni"]))?string.Empty:(System.String)reader["DTSkraceni"];
			entity.RedBr = reader.IsDBNull(reader.GetOrdinal("RedBr")) ? null : (System.Int32?)reader["RedBr"];
			//entity.RedBr = (Convert.IsDBNull(reader["RedBr"]))?(int)0:(System.Int32?)reader["RedBr"];
			entity.SifraSkladista = (System.String)reader["SifraSkladista"];
			//entity.SifraSkladista = (Convert.IsDBNull(reader["SifraSkladista"]))?string.Empty:(System.String)reader["SifraSkladista"];
			reader.Close();
	
			entity.AcceptChanges();
		}
		
		/*
		/// <summary>
		/// Refreshes the <see cref="VwDokument"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="VwDokument"/> object.</param>
		protected static void RefreshEntity(DataSet dataSet, VwDokument entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.Oznaka = (Convert.IsDBNull(dataRow["Oznaka"]))?string.Empty:(System.String)dataRow["Oznaka"];
			entity.Datum = (Convert.IsDBNull(dataRow["Datum"]))?DateTime.MinValue:(System.DateTime)dataRow["Datum"];
			entity.Od = (Convert.IsDBNull(dataRow["Od"]))?string.Empty:(System.String)dataRow["Od"];
			entity.Prema = (Convert.IsDBNull(dataRow["Prema"]))?string.Empty:(System.String)dataRow["Prema"];
			entity.Primio = (Convert.IsDBNull(dataRow["Primio"]))?string.Empty:(System.String)dataRow["Primio"];
			entity.Izdao = (Convert.IsDBNull(dataRow["Izdao"]))?string.Empty:(System.String)dataRow["Izdao"];
			entity.ImeKlijenta = (Convert.IsDBNull(dataRow["ImeKlijenta"]))?string.Empty:(System.String)dataRow["ImeKlijenta"];
			entity.Transport = (Convert.IsDBNull(dataRow["Transport"]))?string.Empty:(System.String)dataRow["Transport"];
			entity.Napomena = (Convert.IsDBNull(dataRow["Napomena"]))?string.Empty:(System.String)dataRow["Napomena"];
			entity.Napomena2 = (Convert.IsDBNull(dataRow["Napomena2"]))?string.Empty:(System.String)dataRow["Napomena2"];
			entity.IDDokumentTip = (Convert.IsDBNull(dataRow["IDDokumentTip"]))?(int)0:(System.Int32)dataRow["IDDokumentTip"];
			entity.NabavnaVrijednost = (Convert.IsDBNull(dataRow["NabavnaVrijednost"]))?0:(System.Decimal?)dataRow["NabavnaVrijednost"];
			entity.IDDokument = (Convert.IsDBNull(dataRow["IDDokument"]))?(int)0:(System.Int32)dataRow["IDDokument"];
			entity.IDStatus = (Convert.IsDBNull(dataRow["IDStatus"]))?(int)0:(System.Int32)dataRow["IDStatus"];
			entity.IDOrganizacijaPrema = (Convert.IsDBNull(dataRow["IDOrganizacijaPrema"]))?(int)0:(System.Int32?)dataRow["IDOrganizacijaPrema"];
			entity.IDOrganizacijaOd = (Convert.IsDBNull(dataRow["IDOrganizacijaOd"]))?(int)0:(System.Int32?)dataRow["IDOrganizacijaOd"];
			entity.IDNacinTransporta = (Convert.IsDBNull(dataRow["IDNacinTransporta"]))?(int)0:(System.Int32?)dataRow["IDNacinTransporta"];
			entity.IDNacinPlacanja = (Convert.IsDBNull(dataRow["IDNacinPlacanja"]))?(int)0:(System.Int32?)dataRow["IDNacinPlacanja"];
			entity.NacinPlacanja = (Convert.IsDBNull(dataRow["NacinPlacanja"]))?string.Empty:(System.String)dataRow["NacinPlacanja"];
			entity.VezaDokumenta = (Convert.IsDBNull(dataRow["VezaDokumenta"]))?string.Empty:(System.String)dataRow["VezaDokumenta"];
			entity.DatumDo = (Convert.IsDBNull(dataRow["DatumDo"]))?DateTime.MinValue:(System.DateTime?)dataRow["DatumDo"];
			entity.IDParent = (Convert.IsDBNull(dataRow["IDParent"]))?(int)0:(System.Int32?)dataRow["IDParent"];
			entity.DTSkraceni = (Convert.IsDBNull(dataRow["DTSkraceni"]))?string.Empty:(System.String)dataRow["DTSkraceni"];
			entity.RedBr = (Convert.IsDBNull(dataRow["RedBr"]))?(int)0:(System.Int32?)dataRow["RedBr"];
			entity.SifraSkladista = (Convert.IsDBNull(dataRow["SifraSkladista"]))?string.Empty:(System.String)dataRow["SifraSkladista"];
			entity.AcceptChanges();
		}
		*/
			
		#endregion Helper Functions
	}//end class

	#region VwDokumentFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="VwDokument"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class VwDokumentFilterBuilder : SqlFilterBuilder<VwDokumentColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the VwDokumentFilterBuilder class.
		/// </summary>
		public VwDokumentFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the VwDokumentFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public VwDokumentFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the VwDokumentFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public VwDokumentFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion VwDokumentFilterBuilder

	#region VwDokumentParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="VwDokument"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class VwDokumentParameterBuilder : ParameterizedSqlFilterBuilder<VwDokumentColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the VwDokumentParameterBuilder class.
		/// </summary>
		public VwDokumentParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the VwDokumentParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public VwDokumentParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the VwDokumentParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public VwDokumentParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion VwDokumentParameterBuilder
} // end namespace
